<?php

namespace  app\merchant\controller;
use app\merchant\model\store\User as MerchantLogin;

/**
 * 登录类
 * author 党晓锋
 */
class Login extends  Base{

    /**
     * 商户后台登录
     * @param account 账号
     * @param password 密码
     */
    public function login(){

        $model = new MerchantLogin;

        if ($model->login($this->postData())) {
            return $this->renderSuccess([
                'token' => $model->getToken(),
                'account' => $model->getLoginInfo($model->getToken())
            ],'登录成功');
        }

        return $this->renderError([],$model->getError() ?: '登录失败');

    }

}